package com.gmail.blackdog1987.onedollar.dao;

import com.gmail.blackdog1987.onedollar.dao.hibernate.EntityHibernateDao;
import com.gmail.blackdog1987.onedollar.dao.hibernate.jdbc.BaseJdbcDao;
import com.gmail.blackdog1987.onedollar.dao.hibernate.jdbc.JdbcUtil;
import com.gmail.blackdog1987.onedollar.entity.TGoodsEntity;
import com.gmail.blackdog1987.onedollar.entity.TGoodsShowEntity;
import com.gmail.blackdog1987.onedollar.entity.TOrderOnedollarEntity;
import com.gmail.blackdog1987.onedollar.entity.base.Page;
import com.gmail.blackdog1987.onedollar.vo.GoodsOneDollarWinnerVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository("oneDorllarWinnerDao")
public class OneDorllarWinnerDao extends EntityHibernateDao<TOrderOnedollarEntity>{
    @Autowired
    private BaseJdbcDao baseJdbcDao;

    public List<GoodsOneDollarWinnerVO> query(String orderid){
        return JdbcUtil.queryForList(baseJdbcDao, GoodsOneDollarWinnerVO.class, "SELECT t.*, u.nick_name FROM t_onedollar_ticket t LEFT JOIN t_user u ON t.user_id=u.user_id WHERE t.onedollar_id = ? AND win=1", new String[]{orderid});
    }

}